package com.gusto.engine.clusterant.algorithms.antsclustering.impl.thread;

import com.gusto.engine.clusterant.algorithms.antsclustering.ants.Ant;

/**
 * <p>Thread that runs the {@link Ant}.</p>
 * 
 * @author amokrane.belloui@gmail.com
 * 
 */
public class AntThread extends Thread {
	
	private Ant ant;
	private AntThreadListener listener;
	
	public AntThread(Ant ant, AntThreadListener listener) {
		super();
		this.ant = ant;
		this.listener = listener;
	}
	
	public void run() {
		while (!ant.isFinishedJob()) {
			ant.moveSomehere();
			ant.doSomething();
		}
		listener.jobFinished(ant);
	}
	
}
